﻿using KPIS.GERP.Models.Resources;
using System.ComponentModel.DataAnnotations;

namespace KPIS.GERP.Models.Class
{
    public class CustomRequiredAttribute : RequiredAttribute
    {
        public CustomRequiredAttribute()
        {
            base.ErrorMessageResourceName = "RequiredMessage";
            base.ErrorMessageResourceType = typeof(ErrorMessage);
        }
    }

    public class CustomStringLengthAttribute : StringLengthAttribute
    {
        public CustomStringLengthAttribute() : this(255)
        {
        }

        public CustomStringLengthAttribute(int maximumLength) : base(maximumLength)
        {
            base.ErrorMessageResourceName = "StringLengthMessage";
            base.ErrorMessageResourceType = typeof(ErrorMessage);
        }
    }

    public static class ValidateText
    {
        public static string RequiredField { get { return ErrorMessage.RequiredField; } }
    }
}
